package at.socialconference.web.client.ui;

import at.socialconference.inter.model.User;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.Label;

public class LabelLinkedUser extends Label implements ClickHandler{
	private User user;
	private boolean hasPendingRelation = true;
	
	public LabelLinkedUser(User user, boolean hasPendingRelation) {
		this(user);
		this.hasPendingRelation = hasPendingRelation;
	}
	
	public LabelLinkedUser(User user) {
		this.user = user;
		setText(user.getFirstname() + " " + user.getLastname());
		addClickHandler(this);
		setStyleName("textbigunderlined");
	}
	@Override
	public void onClick(ClickEvent event) {
		if (hasPendingRelation)
			new UserPopup(user, this).show();
		else 
			new UserPopup(user).show();
	}
}